<!--
  *@Description : In user setting edit
  *@author 萧红
  *@date 2020-05-16 12:24
  *@LastEditTime 2020-05-16 12:24
  *@LastEdititors
-->
<template>
  <div id="page">
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page.sync="currentPage"
      :total="total"
      background
      layout="prev, pager, next, jumper"
    >
    </el-pagination>
  </div>
</template>

<script>
export default {
  name: 'Page',
  props: {
    total: {
      type: Number,
      required: true
    }
  },
  data () {
    return {
      currentPage: 1
    }
  },
  mounted () {
    console.log(this.total)
  },
  methods: {
    handleCurrentChange (val) {
      console.log(`当前页: ${val}`)
      this.$emit('pageChange', val)
    },
    handleSizeChange (val) {
      console.log(`每页 ${val} 条`)
      this.$emit('pageChange', val)
    }
  }
}
</script>

<style scoped>
#page
{
  padding: 20px 0px;
}
</style>
